<?php
/**
 * Author Yulin
 * Email  dwzhanglong@126.com
 * Date   2017-7-21
 * Func   资金日志
 */
defined('IN_YuLin') || exit('NO PERMIT!');

if(!$_uid)
{
	header('Location: '.MU('login'));
	exit;
}

$table = Table('user_money_log');

$tids = [1=>'充值','购买彩票','提现','彩票中奖'];

$data  = [];
$where = ' FROM '.$table.' t WHERE t.uid = '.$_uid;

$tid = intval($_GET['tid']);
$tid && $where .= ' AND t.tid = '.$tid;

$title = NoBadStr($_GET['title']);
$title && $where .= ' AND l.notes LIKE \'%'.$title.'%\'';

$page = max(1,intval($_GET['page']));
$size = 20;

$tmp = $db->getrow('SELECT COUNT(1) AS p '.$where);
if($tmp['p'])
{
	$limit = ' LIMIT '.($page - 1) * $size.','.$size;

	$url = MU($c.'/'.$a,['tid'=>$tid,'title'=>$title]);
	$orderby = ' ORDER BY t.id DESC ';
	
	$data = $db->getall('SELECT t.* '.$where.$orderby.$limit);
	
	//$multi = Multi($url,$page,$tmp['p'],$size);
}

$tpl->display('wap/money');